const log4js = require('log4js');

log4js.configure({
	appenders: { // 输出源
		out: {type: "stdout"},
		app: {
			type: "file",
			filename: "./logs/Journal.log",
			maxLogSize: 5242880,
			backups: 10
		},
		err: {
			type: "file",
			filename: "./logs/err.log",
			maxLogSize: 5242880,
			backups: 10
		}
	},
	categories: { // 类别
		default: {appenders: ["out"], level: "debug"},
		"主要日志": {appenders: ["out", "app"], level: "info"},
		err: {appenders: ["err"], level: "error"}
	},
	pm2: true,
	pm2InstanceVar: 'INSTANCE_ID',
})

const normal = log4js.getLogger("主要日志")
const err = log4js.getLogger("err")

module.exports = {
	normal,
	err
}
